<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Untitled Document</title>
        <script type="text/javascript" src="jquery-1.4.2.js">
        </script>
		
        <script type="text/javascript">
            

var data = new Array();


function Manager(){

    this.populationArray = new Array();
    this.UIStack = new Array();
        
}


Manager.prototype.push = function(component){
    this.UIStack.push(component);    
}


Manager.prototype.pop = function(component){
    this.UIStack.pop(component);   
}

Manager.prototype.addPopulation = function(Population){
    this.populationArray[this.populationArray.length] = Population;
}



Manager.prototype.getPopulation = function(i){
    if (i < 0 || i >= populationArray.length) 
        return null;
    return populationArray[i];
    
}

Manager.prototype.numPopulation = function(){
    return populationArray.length;
}


function onSuccess(data){

    //$('#test').html(data);
    
  //  alert(data);
   // alert('Load was performed.');
    
}

Manager.prototype.fetch = function(){


    var url = 'testSite.txt';
    
    try {
    
        //$("#test").load(url);
        var request = $.ajax({
            url: url,
            async: false
        });
        
        
      //  alert(request.responseText);
        
        var response = request.responseText;
        
        //this.data = new Array();
        
        $(response).find('Population').each(function(){
        
        
            var $thisGuy = $(this);
            
            if ($thisGuy.find('Error').text() == "") {
                data.push($thisGuy.find('Value').text());
            }
            
            
            
        });
    //    alert(data);
         
        
        
    } 
    catch (e) {
        alert(e);
    }
    
    
    /* $.ajax({
    
    
     url: url,
    
    
     data: '',
    
    
     success: function(data){
    
    
     alert("Data Loaded: " + data);
    
    
     
    
    
     
    
    
     alert(data.getElementsByTagName("Value")[0]);
    
    
     
    
    
     
    
    
     $(data).find("Population").each(function(){
    
    
     alert("found a populations");
    
    
     });
    
    
     },
    
    
     dataType: 'text/xml'
    
    
     });*/
    
    
}


try {


    var testManager = new Manager();
    
    testManager.push(1);
    /*    
     
     
     alert(testManager.UIStack[0]);
     
     var testPopulation0 = "test population 0";
     
     var testPopulation1 = "test population 1";
     
     testManager.addPopulation(testPopulation0);
     
     testManager.addPopulation(testPopulation1);
     */
    testManager.fetch();
    
} 
catch (e) {

  //  // alert("Error: " + e)
    
}

        </script>
    </head>
    <body>
        <div id="test">
        </div>
    </body>
</html>
